package org.zfes.snowier.cloud.zbss.cms.router.service.words;

import java.util.Map;
import java.util.Optional;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.zfes.snowier.core.data.DataSet;
import org.zfes.snowier.web.controller.BaseController;
import org.zfes.snowier.cloud.zbss.cms.words.model.CmsWordsSensitive;
import org.zfes.snowier.cloud.zbss.cms.words.service.ICmsWordsSensitiveService;
@Controller 
@RequestMapping("/cms/words/cmsWordsSensitive")
public class CmsWordsSensitiveController extends BaseController {

	
	@Autowired
	private ICmsWordsSensitiveService cmsWordsSensitiveService;
	
	@RequiresPermissions(value="cmsWordsSensitive:loadCmsWordsSensitiveDataSet",desc="敏感词列表")
    @RequestMapping(value="/loadCmsWordsSensitiveDataSet", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object loadCmsWordsSensitiveDataSet(@RequestParam Map<String,Object> params){
	    DataSet dataSet=  cmsWordsSensitiveService.loadCmsWordsSensitiveDataSet(params);
	    return ajaxQuery("dataSet", dataSet);
    }
	
	@RequiresPermissions(value="cmsWordsSensitive:createCmsWordsSensitive",desc="敏感词添加")
    @RequestMapping(value="/createCmsWordsSensitive", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public  @ResponseBody Object createCmsWordsSensitive(CmsWordsSensitive cmsWordsSensitive){
		cmsWordsSensitiveService.createCmsWordsSensitive(cmsWordsSensitive);
    	return ajaxDoneSuccess("数据操作成功 ");
    }
	
	@RequiresPermissions(value="cmsWordsSensitive:loadCmsWordsSensitive",desc="敏感词加载")
    @RequestMapping(value="/loadCmsWordsSensitive", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object loadCmsWordsSensitive(Long id){
		Optional<CmsWordsSensitive> ops = cmsWordsSensitiveService.loadCmsWordsSensitiveById(id);
		return ajaxQuery("cmsWordsSensitive",ops);
    }
	
	@RequiresPermissions(value="cmsWordsSensitive:updateCmsWordsSensitive",desc="敏感词更新")
    @RequestMapping(value="/updateCmsWordsSensitive", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object updateCmsWordsSensitive(CmsWordsSensitive cmsWordsSensitive){
		cmsWordsSensitiveService.updateCmsWordsSensitive(cmsWordsSensitive);
		return ajaxDoneSuccess("数据操作成功 ");
    }
	
	@RequiresPermissions(value="cmsWordsSensitive:deletCmsWordsSensitive",desc="敏感词删除")
    @RequestMapping(value="/deleteCmsWordsSensitive", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object deleteCmsWordsSensitive(Long id){
		cmsWordsSensitiveService.deleteCmsWordsSensitive(id);
		return ajaxDoneSuccess("数据操作成功 ");
    }

}